package com.leyou.fallback;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author jshstart
 * @creat 2020-12-08 19:47
 */
@RestController
@RequestMapping("/hystrix")
public class FallBackController {
    @RequestMapping("/fallback")
    public ResponseEntity<Map<String,Object>> handleFallBack(){
        Map map=new HashMap<String,Object>();
        map.put("code",400);
        map.put("msg","请求超时，请重试");
        return ResponseEntity.status(HttpStatus.GATEWAY_TIMEOUT).body(map);
    }
}
